package com.appspot.bs24event.model;

import java.io.Serializable;

    import javax.jdo.annotations.Persistent;
import org.slim3.datastore.Attribute;
import org.slim3.datastore.Model;

import com.google.appengine.api.datastore.Key;


@Model(schemaVersion = 1)
public class Token implements Serializable {

    private static final long serialVersionUID = 1L;


    public Token() {
        super();
    }
    public Token(String botName, String accessToken, String accessSecret) {
        super();
        this.botName = botName;
        this.accessToken = accessToken;
        this.accessSecret = accessSecret;
    }


//    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
//    private Long id;

    @Persistent
    private String botName;

    @Persistent
    private String accessToken;

    @Persistent
    private String accessSecret;


    @Attribute(primaryKey = true)
    private Key key;

    @Attribute(version = true)
    private Long version;

    /**
     * botNameを取得します。
     * @return botName
     */
    public String getBotName() {
        return botName;
    }
    /**
     * botNameを設定します。
     * @param botName botName
     */
    public void setBotName(String botName) {
        this.botName = botName;
    }
    /**
     * accessTokenを取得します。
     * @return accessToken
     */
    public String getAccessToken() {
        return accessToken;
    }
    /**
     * accessTokenを設定します。
     * @param accessToken accessToken
     */
    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }
    /**
     * accessSecretを取得します。
     * @return accessSecret
     */
    public String getAccessSecret() {
        return accessSecret;
    }
    /**
     * accessSecretを設定します。
     * @param accessSecret accessSecret
     */
    public void setAccessSecret(String accessSecret) {
        this.accessSecret = accessSecret;
    }
    /**
     * Returns the key.
     *
     * @return the key
     */
    public Key getKey() {
        return key;
    }

    /**
     * Sets the key.
     *
     * @param key
     *            the key
     */
    public void setKey(Key key) {
        this.key = key;
    }

    /**
     * Returns the version.
     *
     * @return the version
     */
    public Long getVersion() {
        return version;
    }

    /**
     * Sets the version.
     *
     * @param version
     *            the version
     */
    public void setVersion(Long version) {
        this.version = version;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((key == null) ? 0 : key.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        Token other = (Token) obj;
        if (key == null) {
            if (other.key != null) {
                return false;
            }
        } else if (!key.equals(other.key)) {
            return false;
        }
        return true;
    }
}
